from PIL import Image
from torchvision.transforms import transforms

img = Image.open('../data/MNIST/0.png')
img = img.convert('L')
img.show()
transform = transforms.Compose([transforms.ToTensor()])
img = transform(img)
print(img, img.shape)

img = 1.0-img
toPIL = transforms.ToPILImage()
pic = toPIL(img)
print(img, img.shape)
pic.show()
